package com.gcl.kgsvc.controller;

import com.gcl.kgsvc.service.Neo4jService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("neo4j")
public class Neo4jController {

    @Autowired
    private Neo4jService neo4jSvc;

    @GetMapping("add")
    @ResponseBody
    public Map<String, Object> addTest() {
        // 请求地址为  localhost:8080/neo4j/add
        return neo4jSvc.addPerson();
    }

    @GetMapping("find")
    public Map<String, Object> findTest(@RequestParam("name") String name) {
        // 请求地址为  localhost:8080/neo4j/find?name=gcl
        return neo4jSvc.findPerson(name);
    }

    @GetMapping("findby")
    public Map<String, Object> findByTest(@RequestParam("name") String name) {
        // 请求地址为  localhost:8080/neo4j/findby?name=gcl
        return neo4jSvc.findPersonBy(name);
    }
}
